package com.changgou.search.listener;

import com.changgou.search.config.RabbitMQConfig;
import com.changgou.search.service.EsManagerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @version v1.0
 * @ProjectName: changgou_parent
 * @ClassName: GoodsUpListener
 * @Description: TODO(一句话描述该类的功能)
 * @Author: Xu Fj
 * @Date: 2020/2/29 20:30
 */
@Component
public class GoodsUpListener {
    @Autowired
    private EsManagerService esManagerService;

    @RabbitListener(queues = RabbitMQConfig.SEARCH_ADD_QUEUE)
    public void receiveMessage(String spuId){
        System.out.println("接收到的消息为:"+spuId);

        esManagerService.importDataToESBySpuId(spuId);
    }
}
